<?php
/*
This controller is used to generate the
data model via Doctrine ORM from a DB
schema. Make sure the connection string 
below contains the info related to your 
database. It can be discarded after it 
is run.
*/
class Ormgen extends Controller
{
	function Ormgen()
	{
		parent::Controller();
	}
	
	function modelgen()
	{
		define('MOD_DIR', APPPATH . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR);		
		
		Doctrine_Manager::connection('mysql://root:secretepassword@localhost/dbname', 'dbname');
		
		Doctrine::generateModelsFromDb(MOD_DIR, array('dbname'), array('generateTableClasses' => true));
		
		echo 'Data Model Class Generation Complete!';
		
		return;
	}
}

//EOF